-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make propagators conform to spec #488
Make propagators conform to spec #488
Conversation
* do not modify / set an invalid span in the passed context in case a propagator did not manage to extract * in case no context is passed to propagator.extract assume the root context as default so that a new trace is started instead of continung the current active trace in case extraction fails * fix also ot-trace propagator which compared int with str trace/span ids when checking for validity in extract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Probably it's better we log warning when there is some error extracting span id or trace id or anything.
@@ -42,6 +42,9 @@ def extract( | |||
context: typing.Optional[Context] = None, | |||
getter: Getter = default_getter, | |||
) -> Context: | |||
if context is None: | |||
context = Context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this PR description you mention this, @mariojonke:
Propagators should return the passed in context (or the current one if none was given) if nothing could be extracted.
Should we use the current context instead of instantiating a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided in the SIG meeting to use the root context as default because the current context would continue a possible active trace instead of starting a new one if extracting from the carrier fails (see also open-telemetry/opentelemetry-python#1765 (comment))
See also PR in the core repo: open-telemetry/opentelemetry-python#1811
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
Propagators use the root context as default value for the extract operation. Additionally avoid modifying the context in case there is nothing to extract or the carrier does not hold valid data.
Fixes open-telemetry/opentelemetry-python#1765
Fixes also an issue in the
ot-trace
propagator where trace/span id validity was comparing str with int values.Type of change
How Has This Been Tested?
unit tests have been added/adapted
Does This PR Require a Core Repo Change?
Checklist: